/*
 * @Author: dvlproad
 * @Date: 2023-10-30 18:28:40
 * @LastEditors: dvlproad
 * @LastEditTime: 2023-10-30 19:40:16
 * @Description: 
 */
import 'package:flutter/material.dart';

import 'ts_shared_normalview_util.dart';

class TSSharedNormalViewContainer extends StatefulWidget {
  @override
  TSSharedNormalViewContainerState createState() {
    // debugPrint(" TSSharedNormalViewContainer 创建 createState");
    return TSSharedNormalViewContainerState();
    // return TSSharedNormalViewUtil.sharedNormalViewContainerState;
  }
}

class TSSharedNormalViewContainerState
    extends State<TSSharedNormalViewContainer> {
  int count = 10;

  @override
  void dispose() {
    super.dispose();
    debugPrint(" TSSharedNormalViewContainerState 销毁");
  }

  @override
  void initState() {
    super.initState();
    debugPrint(" TSSharedNormalViewContainerState 初始化");

    count = 0;
  }

  @override
  Widget build(BuildContext context) {
    return Container(
      color: Colors.green,
      child: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        children: [
          const Text(
            '我是一个视图实例',
            style: TextStyle(fontSize: 16),
          ),
          ElevatedButton(
            onPressed: addCount,
            style: ElevatedButton.styleFrom(
              foregroundColor: Colors.red,
              backgroundColor: Colors.grey,
            ),
            child: const Text('点击我'),
          ),
          Text(
            '$count',
            style: const TextStyle(fontSize: 16),
          ),
        ],
      ),
    );
  }

  void addCount() {
    setState(() {
      count++;
    });
  }
}
